<template>
    <el-button-group class="min-max-close">
        <el-button icon="el-icon-minus" @click="minWindow" size="mini"></el-button>
        <el-button icon="el-icon-full-screen" v-if="full_screen" @click="maxWindow" size="mini"></el-button>
        <el-button icon="el-icon-copy-document" v-if="!full_screen" @click="maxWindow" size="mini"></el-button>
        <el-button icon="el-icon-close" @click="closeWindow" size="mini"></el-button>
    </el-button-group>
</template>

<script>
    const electron = window.require('electron');
    const {ipcRenderer, remote} = electron;

    export default {
        name: "MinMaxClose",
        data() {
            return {
                full_screen: true
            }
        },
        methods: {
            minWindow() {
                ipcRenderer.send('min-window', remote.getCurrentWindow().id);
            },
            maxWindow() {
                ipcRenderer.send('max-window', remote.getCurrentWindow().id);
                this.full_screen = !this.full_screen
            },
            closeWindow() {
                ipcRenderer.send('close-window', remote.getCurrentWindow().id);
            },
        },
    }
</script>

<style scoped>
    .min-max-close {
        position: absolute;
        top: 0;
        right: 0;
    }
</style>